{% extends "blogs/admin/base_blog.html" %}

{% block current_action %}Dashboard{% endblock %}

{% block content %}

    <p>You can do the following actions on this blog.</p>
    <ul>
        <li><a href="{% url blogs.main.index blog.slug %}"><strong>View this blog</strong></a></li>
        <li><a href="{% url blogs.admin.post_add blog.slug %}"><strong>Write a new post</strong></a></li>
        <li><a href="{% url blogs.admin.comments blog.slug %}"><strong>Manage comments</strong></a></li>
        <li><a href="{% url blogs.admin.blogroll blog.slug %}"><strong>Manage blogroll (links)</strong></a></li>
        <li><a href="{% url blogs.admin.banned_ips blog.slug %}"><strong>Manage banned IPs</strong></a></li>
        <li><a href="{% url blogs.admin.blog_details blog.slug %}"><strong>Edit details for this blog</strong></a></li>
    </ul>

    <h2>Published Posts</h2>
    
    {% if published %}

        <p>Here {{ published|length|pluralize:"is,are"}} the most recently published post{{ published|length|pluralize:"s"}}. Click on the title to edit a post.</p>

        <table>
            <thead>
                <tr>
                    <th>Title</th>
                    <th>Author</th>
                    <th>Published</th>
                    <th>Blurb</th>
                    <th colspan="2">Action</th>
                </tr>
            </thead>
            <tbody>
                {% for post in published %}
                    <tr>
                        <td><a href="{{ post.get_absolute_url }}" title="View this post">{{ post }}</a></td>
                        <td>{{ post.byline }}</td>
                        <td>{{ post.pub_date|date:blog.date_format }}, {{ post.pub_date|date:blog.time_format }}</td>
                        <td>{{ post.body|truncatewords_html:100|striptags }}</td>
                        <td><a href="{% url blogs.admin.post_edit blog_slug,post.slug %}" title="Edit post"><img src="{{ ADMIN_MEDIA_PREFIX }}img/admin/icon_changelink.gif" alt="edit" /></a></td>
                        <td><a href="{% url blogs.admin.post_delete blog_slug,post.slug %}" title="Delete post"><img src="{{ ADMIN_MEDIA_PREFIX }}img/admin/icon_deletelink.gif" alt="delete" /></a></td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    
        {% include 'blogs/admin/posts_nav.html' %}
    
    {% else %}

        <p>There are no published posts for this blog.</p>
    
    {% endif %}

    <h2>Recent Drafts</h2>
    
    {% if drafts %}
    
        <p>{{ drafts|length|pluralize:"This draft has,These drafts have"}} not been published yet. Click on the title to edit a draft.</p>

        <table>
            <thead>
                <tr>
                    <th>Title</th>
                    <th>Author</th>
                    <th>Last Modified</th>
                    <th>Blurb</th>
                    <th colspan="2">Action</th>
                </tr>
            </thead>
            <tbody>
                {% for post in drafts %}
                    <tr>
                        <td>{{ post }}</td>
                        <td>{{ post.byline }}</td>
                        <td>{{ post.mod_date|date:blog.date_format }}, {{ post.mod_date|date:blog.time_format }}</td>
                        <td>{{ post.body|truncatewords_html:100|striptags|safe }}</td>
                        <td><a href="{% url blogs.admin.post_edit blog_slug,post.slug %}" title="Edit draft"><img src="{{ ADMIN_MEDIA_PREFIX }}img/admin/icon_changelink.gif" alt="edit" /></a></td>
                        <td><a href="{% url blogs.admin.post_delete blog_slug,post.slug %}" title="Delete draft"><img src="{{ ADMIN_MEDIA_PREFIX }}img/admin/icon_deletelink.gif" alt="delete" /></a></td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
      
    {% else %}
    
        <p>There are no unpublished posts for this blog.</p>
    
    {% endif %}

{% endblock %}